package org.scc.service;

import java.util.List;

import org.scc.dao.RoleDao;
import org.scc.model.Resource;
import org.scc.model.Role;
import org.scc.model.User;

public class RoleService {
	private RoleDao roleDao;
	public RoleService(){
		roleDao = new RoleDao();
	}
	
	public List<Role> findAll(){
		return roleDao.findAll();
	}
	
	public Role load(int id){
		return roleDao.load(id);
	}
	
	public void add(Role role){
		roleDao.add(role);
	}
	
	public void update(Role role){
		roleDao.update(role);
	}
	
	public void delete(String ids){
		roleDao.delete(ids);
	}
	
	public List<Resource> findResource(int roleId){
		return roleDao.findResource(roleId);
	}
	
	public void addResource(int roleId, String resourceIds){
		roleDao.addResource(roleId, resourceIds);
	}
	
	public void removeResource(int roleId, String resourceIds){
		roleDao.removeRes(roleId, resourceIds);
	}
	
	public List<Role> findScopeAll(){
		return roleDao.findScopeAll();
	}
	
	public List<Role> findUserRoles(int userId){
		return roleDao.findUserRole(userId);
	}
	
	public List<User> findRoleUsers(int roleId){
		return roleDao.findRoleUsers(roleId);
	}
	
	public void addUsers(int roleId, String userIds){
		roleDao.addUsers(roleId, userIds);
	}
	
	public void removeUsers(int roleId,String userIds){
		roleDao.removeUsers(roleId, userIds);
	}
	
	public List<Resource> findSLRes(int roleId){
		return roleDao.findSLResource(roleId);
	}
}
